File filtering_Python 3.2 [closed]
Posted
by
user71261
on Super User
See other posts from Super User
or by user71261
Published on 2011-03-11T15:04:40Z
Indexed on
2011/03/11
16:12 UTC
Read the original article
Hit count: 132
I'm trying to write a short file filtering code in Python that will find my desired string.
I've got it worked out logically, but my Command Feed is sending me an error message for the print statement. This is how it works as of now:
filename = input('give file name: ')
n = input('give desired string: ')
f = open
line = f.readline()
while line:
if n in line:
print line
line = f.readline()
Error Statement:
Traceback (most recent call last):
File "<string>", line 7, in <fragment>
Syntax Error: print line: <string>, line 718
I know this is a simple problem but the answer is not obvious to me. please help.
© Super User or respective owner